package com.huangxt.test.jasypt;

import org.jasypt.util.text.BasicTextEncryptor;

public class JasyptUtil {
    public static String encrypt(String pwd,String salt){
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        //加密所需的salt(盐)
        textEncryptor.setPassword("salt");
        //要加密的数据（数据库的用户名或密码）
        return textEncryptor.encrypt(pwd);
    }public static String decrypt(String pwd,String salt){
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        //加密所需的salt(盐)
        textEncryptor.setPassword("salt");
        return textEncryptor.decrypt(pwd);
    }
}
